<?php
    if (count($_GET) + count($_POST) > 0) {
        if (isset($_POST['test']) && ($_POST['test'] == 'json')) {
            $return = array('one' => 1, 'two' => array('1', 2, 3));
            echo json_encode($return);
        } elseif (isset($_POST['test']) && ($_POST['test'] == 'script')) {
            ?>document.getElementById('scriptTest').innerHTML = 'OK'<?php
        } else {
            ?>GET:<br /><pre><?php
            print_r($_GET);
            ?></pre><br />POST:<pre><?php
            print_r($_POST);
            ?></pre><?php
        }
        exit();
    }
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title></title>
        <script src="ajaxlib2.1.js" type="text/javascript"></script>
        <script src="test2.1.js" type="text/javascript"></script>
        <style type="text/css" media="screen">
            <!--
            .passed, .failed {
                display: inline-block;
                width: 10px;
                height: 10px;
                background-color: #0f0
            }

            .failed {
                background-color: #f00;
            }

            td {
                border-right: 1px solid #777;
                border-bottom: 1px solid #777;
                font: 10px Verdana;
            }

            td:last-child {
                border-right: 0px;
            }

            form {
                display: none;
            }
            -->
        </style>
    </head>
    <body>
        <h1>AJAXlib2.1 test</h1>
        <table><tbody></tbody></table>
        <form action="">
            <input type="text" name="simple" value="1" />
            <input name="multi[]" value="a" />
            <input type="text" name="multi[]" value="b" />
            <input type="text" name="multi[4]" value="c" />
            <select name="firstSelect">
                <option value="1"></option>
                <option value="2"></option>
            </select>
            <select name="multiselect[]" multiple="multiple">
                <option value="1" selected="selected"></option>
                <option value="2"></option>
                <option value="4" selected="selected"></option>
            </select>
            <textarea name="text" cols="40" rows="5">some text</textarea>
            <input name="multi[5][0]" value="value" />
            <input type="checkbox" name="checked" value="1" checked="checked" />
            <input type="checkbox" name="unchecked" value="2" />
            <input type="radio" name="radio" value="1" checked="checked" />
            <input type="radio" name="radio" value="0" />
        </form>
    </body>
</html>